﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace ApplicationLayer
{
    public partial class frmDeThi_TaoDe : DevComponents.DotNetBar.OfficeForm
    {
        public frmDeThi_TaoDe()
        {
            InitializeComponent();
        }
        public bool GiaiThuatGen = false;
        public bool GiaiThuat()
        {
            return GiaiThuatGen;
        }
        
        private void frmDeThi_TaoDe_Load(object sender, EventArgs e)
        {
            cboCachTaoDe.SelectedIndex = 0;
            
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            int i =0;
            if (txtTenDeThi.Text.Trim().Length == 0)
            {
                errorProvider1.SetError(txtTenDeThi, "Dữ liệu trống!");
                txtTenDeThi.Focus();
                txtTenDeThi.SelectAll();
                return;
            }
            if ((int)numThoiGian.Value == 0)
            {
                errorProvider1.SetError(numThoiGian, "Phải lớn hơn 0!");
                numThoiGian.Focus();
                numThoiGian.Select();
                return;
            }
            if ((int)numSoCauHoi.Value == 0)
            {
                errorProvider1.SetError(numSoCauHoi, "Phải lớn hơn 0!");
                numSoCauHoi.Focus();
                numSoCauHoi.Select();
                return;
            }
             if (cboCachTaoDe.SelectedIndex == 0)
                 GiaiThuatGen = false;
             else
                 GiaiThuatGen = true;
             DialogResult = System.Windows.Forms.DialogResult.OK;
            
        }
        public string TenDeThi()
        {
            return txtTenDeThi.Text;
        }
        public string ThoiGian()
        {
            return numThoiGian.Value.ToString();
        }
        public int SoCauHoi()
        {
            return (int)numSoCauHoi.Value;
        }   
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void labelX1_Click(object sender, EventArgs e)
        {

        }

        private void cboCachTaoDe_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void txtSoCauHoi_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar < '0' || e.KeyChar > '9') {
                e.Handled = true;
            }
        }

        private void txtThoiGian_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar < '0' || e.KeyChar > '9')
            {
                e.Handled = true;
            }
        }

        private void cboCachTaoDe_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;
        }
        
    }
}